﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="PostInfoPage.aspx.cs" Inherits="MAA.Presentation.PRL.Trading.PostInfoPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="../Scripts/jquery-2.0.3.min.js" type="text/javascript"></script>
    <link href="../Styles/PostInfo.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <br/>
    <asp:Label ID="LblMes" runat="server" Text="" ForeColor="Red" Style="margin-left:10px;"></asp:Label>
    <div class="Upper">
        <div class="PostInfo">
            <h2>
                <asp:Label ID="langPostInformation" runat="server" Text="<%$Resources:language, langPostInformation%>"></asp:Label></h2>
            <br />
            <div class="info" style="display: inline-block; float: left;">
                <label style="margin-left: 150px;">
                    <asp:Label ID="langRiceType" runat="server" Text="<%$Resources:language, langRiceType%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langAmount" runat="server" Text="<%$Resources:language, langAmount%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langPostTradedAmount" runat="server" Text="<%$Resources:language, langPostTradedAmount%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langUnitPrice" runat="server" Text="<%$Resources:language, langUnitPrice%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langPostPerPrice" runat="server" Text="<%$Resources:language, langPostPerPrice%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langAddress" runat="server" Text="<%$Resources:language, langAddress%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langProvince" runat="server" Text="<%$Resources:language, langAddress%>"></asp:Label>:</label><br />
                <br />
                <label style="margin-left: 150px;">
                    <asp:Label ID="langDateBuy" runat="server" Text="<%$Resources:language, langDateBuy%>"></asp:Label>:</label><br />
                <br />
            </div>
            <div class="enter" style="display: inline-block; margin-left: 10px;">
                <asp:Label runat="server" ID="lblPostRice"></asp:Label><br />
                <br />
                <asp:Label runat="server" ID="lblPostAmount"></asp:Label>kg<br />
                <br />
                <asp:Label runat="server" ID="lblPostTradedAmount"></asp:Label>kg<br />
                <br />
                <asp:Label runat="server" ID="lblPostPrice"></asp:Label>vnd<br />
                <br />
                <asp:Label runat="server" ID="lblPostPerPrice"></asp:Label>%<br />
                <br />
                <asp:Label runat="server" ID="lblPostAddress"></asp:Label><br />
                <br />
                <asp:Label runat="server" ID="lblPostProvince"></asp:Label><br />
                <br />
                <asp:Label runat="server" ID="lblPostCreateDate"></asp:Label><br />
                <br />
            </div>
        </div>
        <div class="Poster">
            <div class="PosterInfo">
                <h2>
                    <asp:Label ID="langPosterInformation" runat="server" Text="<%$Resources:language, langPosterInformation%>"></asp:Label></h2>
                <br />
                <asp:Label Style="margin-left: 50px;" ID="lblSellerName" runat="server"></asp:Label>
                <br />
                <br />
                <asp:ImageMap Style="margin-left: 50px;" ID="impSellerPicture" runat="server">
                </asp:ImageMap>
                <br />
                <br />
                <asp:Label Style="margin-left: 50px;" ID="lblSellerAddress" runat="server"></asp:Label>
                <asp:Label ID="lblSellerProvince" runat="server"></asp:Label>
                <br />
                <br />
            </div>
            <div id="divReport" class="report_postInfo" runat="server">
                <div style="display: inline-block; cursor: pointer;" id="lbtReport">
                    <h2>
                        <asp:Label ID="langReportBreach" runat="server" Text="<%$Resources:language, langReportBreach%>"></asp:Label>
                        <asp:ImageMap ID="ImageMap1" runat="server" ImageUrl="~/WebData/Image/WebImage/ShowMore.png">
                        </asp:ImageMap>
                    </h2>
                </div>
                <div style="display: none;" class="OpenTab">
                    <br />
                    <label id="Label1" style="margin-left: 130px;" runat="server">
                        <asp:Label ID="langReason" runat="server" Text="<%$Resources:language, langReason%>"></asp:Label></label>
                    <br />
                    <br />
                    <asp:TextBox MaxLength="255" Style="resize: none; margin-left: 28px; width: 290px;"
                        runat="server" ID="tbxReason" TextMode="MultiLine" onkeypress="return CheckLength();">   
                    </asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="<%$Resources:language, langEnterReason%>"
                        Display="Dynamic" ControlToValidate="tbxReason" ForeColor="Red" SetFocusOnError="True"
                        ValidationGroup="ReportBreach"></asp:RequiredFieldValidator>
                    <br />
                    <asp:Button Style="margin-left: 115px;" runat="server" ID="btnReportBreach" Text="<%$Resources:language, langReport%>"
                        OnClick="btnReportBreach_Click" ValidationGroup="ReportBreach" />
                    <asp:Button runat="server" ID="btnCancel" Text="<%$Resources:language, langCancel%>"
                        OnClick="btnCancel_Click" />
                </div>
            </div>
        </div>
    </div>
    <div id="divOrder" class="Post" runat="server">
        <h2>
            <asp:Label ID="langOrder" runat="server" Text="<%$Resources:language, langOrder%>"></asp:Label></h2>
        <div class="info" style="display: inline-block; float: left;">
            <label style="margin-left: 150px;">
                <asp:Label ID="langAmountOrder" runat="server" Text="<%$Resources:language, langAmount%>"></asp:Label>:</label><br />
            <br />
            <br />
            <br />
            <br />
            <label style="margin-left: 150px;">
                <asp:Label ID="langUnitPrice1" runat="server" Text="<%$Resources:language, langUnitPrice%>"></asp:Label>:</label>
        </div>
        <div class="enter" style="display: inline-block;">
            <asp:TextBox runat="server" ID="tbxOrderAmount" MaxLength="10" ValidationGroup="Order"></asp:TextBox>kg
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Bạn phải nhập số lượng."
                Display="Dynamic" ControlToValidate="tbxOrderAmount" ForeColor="Red" SetFocusOnError="True"
                ValidationGroup="Order"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator4" runat="server" ErrorMessage="Số lượng phải là số nguyên dương."
                ControlToValidate="tbxOrderAmount" Display="Dynamic" ForeColor="Red" MaximumValue="1000000000"
                MinimumValue="1" SetFocusOnError="True" Type="Integer" ValidationGroup="Order"></asp:RangeValidator>
            <br />
            <label>
                <asp:Label ID="langMin" runat="server" Text="<%$Resources:language, langMin%>"></asp:Label></label>
            <asp:Label ID="lblMinOrderAmount" runat="server"></asp:Label>
            <label>
                <asp:Label ID="langLess" runat="server" Text="<%$Resources:language, langLess%>"></asp:Label></label>
            <asp:Label ID="lblMaxOrderAmount" runat="server"></asp:Label><br />
            <br />
            <br />
            <asp:TextBox runat="server" ID="tbxOrderPrice" MaxLength="10"></asp:TextBox>vnd
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Bạn phải nhập giá mua."
                Display="Dynamic" ControlToValidate="tbxOrderPrice" ForeColor="Red" SetFocusOnError="True"
                ValidationGroup="Order"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Giá mua phải là số nguyên dương."
                ControlToValidate="tbxOrderPrice" Display="Dynamic" ForeColor="Red" MaximumValue="1000000000"
                MinimumValue="1" SetFocusOnError="True" Type="Integer" ValidationGroup="Order"></asp:RangeValidator>
            <br />
            <label>
                <asp:Label ID="langPercent" runat="server" Text="<%$Resources:language, langPercent%>"></asp:Label></label><br />
            <br />
            <asp:Button runat="server" ID="btnOrder" Text="<%$Resources:language, langOrder%>"
                OnClick="btnOrder_Click" ValidationGroup="Order" />
        </div>
    </div>
    <div id="divContact" class="Contact" runat="server">
        <h2>
            <asp:Label ID="langSentEmailToPoster" runat="server" Text="<%$Resources:language, langSentEmailToPoster%>"></asp:Label></h2>
        </br>
        <asp:TextBox Style="resize: none; margin-left: 15%; width: 70%; height: 150px;" runat="server"
            TextMode="MultiLine" ID="tbxContactContent"></asp:TextBox><br />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Bạn phải nhập nội dung tin nhắn."
            Display="Dynamic" ControlToValidate="tbxContactContent" ForeColor="Red" SetFocusOnError="True"
            ValidationGroup="Contact"></asp:RequiredFieldValidator>
        <br />
        <br />
        <asp:Button Style="margin-left: 78%; width: 80px;" runat="server" ID="btnContact"
            Text="<%$Resources:language, langSent%>" OnClick="btnContact_Click" ValidationGroup="Contact" />
    </div>
    <div class="OrderList">
        <div style="display: inline-block; cursor: pointer;" id="Div1">
            <h2>
                <asp:Label ID="lbtOrderList2" runat="server" Text="<%$Resources:language, langListOrderNow%>"></asp:Label>
                <asp:ImageMap ID="ImageMap2" runat="server" ImageUrl="~/WebData/Image/WebImage/ShowMore.png">
                </asp:ImageMap>
            </h2>
        </div>
        <br />
        <div style="display: none;" class="ShowOrderList">
            <br />
            <asp:Label runat="server" ID="lblOrderListMess" ForeColor="Red"></asp:Label>
            <asp:GridView Style="margin-left: 15%; width: 70%;" ID="dgvOrderBuyer" runat="server"
                CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False"
                BorderColor="#A11DC2" BorderStyle="Solid" BorderWidth="1px" 
                onrowdatabound="dgvOrderBuyer_RowDataBound">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField HeaderText="Tên" DataField="Name">
                        <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Amount" HeaderText="Số lượng (kg)" SortExpression="Amount">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Price" HeaderText="Giá mua (vnđ)" SortExpression="Price">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Province" HeaderText="Tỉnh/TP" SortExpression="Province">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="CreateDate" HeaderText="Ngày đăng" SortExpression="CreateDate">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="StatusID" HeaderText="StatusID" Visible="False">
                        <HeaderStyle HorizontalAlign="Right" />
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="StatusName" HeaderText="Trạng thái" SortExpression="StatusName">
                        <HeaderStyle HorizontalAlign="Right" />
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                </Columns>
                <EditRowStyle BackColor="#7C6F57" />
                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" />
                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#d2bdf2" Height="30px" />
                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F8FAFA" />
                <SortedAscendingHeaderStyle BackColor="#246B61" />
                <SortedDescendingCellStyle BackColor="#D4DFE1" />
                <SortedDescendingHeaderStyle BackColor="#15524A" />
            </asp:GridView>
        </div>
    </div>

    <script type="text/javascript">
        var checkTab = true;
        var checkTab1 = true;
        $('#lbtReport').bind('click', function (e) {
            if (checkTab) {
                $('.OpenTab').css('display', 'block');
                checkTab = false;
            }
            else {
                $('.OpenTab').css('display', 'none');
                checkTab = true;
            }
        });
        $('#Div1').bind('click', function (e) {
            console.log("AAA");
            if (checkTab1) {
                $('.ShowOrderList').css('display', 'block');
                checkTab1 = false;
            }
            else {
                $('.ShowOrderList').css('display', 'none');
                checkTab1 = true;
            }
        });
    </script>

    <script type="text/javascript">
        function CheckLength() {
            var textbox = document.getElementById("<%=tbxReason.ClientID%>").value;
            if (textbox.trim().length >= 255) {
                return false;
            }
            else {
                return true;
            }
        }
                    </script>
</asp:Content>
